﻿<Window x:Class="WMSSoft.WinKStart.Settings_NewEditDataSource"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:WinKStart="clr-namespace:WMSSoft.WinKStart"
        x:Name="SettingsNewEditDataSource"
        Title="{Binding ViewName}" Height="335" Width="672" ResizeMode="NoResize" ShowInTaskbar="True" WindowStartupLocation="CenterOwner" Icon="/WinKStart;component/grfx/preferences-other.png" WindowStyle="ToolWindow">
    <!--<Window.Resources>
        <ObjectDataProvider x:Key="colors" ObjectType="{x:Type WinKStart:XAMLLanguageString}" MethodName="GetXAMLText"/>
    </Window.Resources>-->
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="25*"/>
            <RowDefinition Height="25*"/>
            <RowDefinition Height="179*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="105*"/>
            <ColumnDefinition Width="218*"/>
            <ColumnDefinition Width="105"/>
            <ColumnDefinition Width="218*"/>
        </Grid.ColumnDefinitions>
        <Label Content="Short Name:" Grid.Column="0" Grid.Row="0" Padding="5,2,5,0"/>
        <TextBox VerticalContentAlignment="Center" Grid.Column="1" Grid.Row="0" TextWrapping="Wrap" Height="20" Text="{Binding DataSourceShortName}" Margin="0,0,0,0"/>
        <Label Content="Name:" Grid.Column="2" Grid.Row="0" Margin="10,0,0,0" Padding="5,2,5,0"/>
        <TextBox VerticalContentAlignment="Center" Grid.Column="3" TextWrapping="Wrap" Height="20" Text="{Binding DataSourceName}"/>
        <Label Content="Assembly:" Grid.Column="0" Grid.Row="1" Margin="0,5,0,0" Padding="5,2,5,0"/>
        <ComboBox Grid.Column="1" Grid.Row="1" Margin="0,5,0,0" Padding="6,1,5,1" ItemsSource="{Binding AvailableAssemblies}"  DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding SelectedAssembly}"/>
        <Label Content="Class" Margin="10,5,0,0" Grid.Column="2" Grid.Row="1" Padding="5,2,5,0"/>
        <ComboBox Margin="0,5,0,0" Grid.Column="3" Grid.Row="1" Padding="6,1,5,1" ItemsSource="{Binding AssemblyClasses}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding SelectedClass}"/>
        <Label Margin="0,5,0,0" Content="Searchable:" Grid.Row="2" Padding="5,2,5,0"/>
        <CheckBox Content="" Grid.Column="1" HorizontalAlignment="Left" Margin="0,7,0,0" Grid.Row="2" VerticalAlignment="Top" Height="15" Width="20" IsChecked="{Binding Searchable}"/>
        <TabControl Grid.Row="3" Margin="0,10,0,0" Grid.ColumnSpan="4">
            <TabItem x:Name="tbi_Parameters" Header="Options">
                <Grid Background="#FFE5E5E5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="37*"/>
                        <ColumnDefinition Width="123*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="40"/>
                    </Grid.RowDefinitions>
                    <ListView x:Name="lv_Parameterers" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding DataSourceOptions}" SelectedValue="{Binding SelectedOption}" Grid.ColumnSpan="2" IsSynchronizedWithCurrentItem="True" IsManipulationEnabled="True">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="Option" Width="200"  DisplayMemberBinding="{Binding Key}"/>
                                <GridViewColumn Header="Value" Width="200"  DisplayMemberBinding="{Binding Value}"/>
                            </GridView>
                        </ListView.View>
                    </ListView>
                    <Button Content="{Binding Cmd_EditOptionClick.ViewName}" HorizontalAlignment="Left" Margin="10,10,0,0" Height="23" Width="100" Grid.Row="1" VerticalAlignment="Top" IsEnabled="{Binding OptionSelected}" Command="{Binding Cmd_EditOptionClick.Command}" CommandParameter="{Binding ElementName=lv_Parameterers}"/>
                </Grid>
            </TabItem>
            <TabItem  Header="User defined Data-Items">
                <Grid Background="#FFE5E5E5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="40"/>
                    </Grid.RowDefinitions>
                    <ListView x:Name="lv_UserDefiniedDataItems" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding CustomItems}" SelectedItem="{Binding SelectedCustomItem}">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="Item" Width="200" DisplayMemberBinding="{Binding ViewName}"/>
                                <GridViewColumn Header="Name" Width="200"  DisplayMemberBinding="{Binding ItemName}"/>
                                <GridViewColumn Header="Filter" Width="200"  DisplayMemberBinding="{Binding Filter}"/>
                            </GridView>
                        </ListView.View>
                    </ListView>
                    <Button Height="23" Width="100" Content="{Binding Cmd_AddClick.ViewName}" Grid.Column="0" Grid.Row="1" Margin="10,5,0,5" HorizontalAlignment="Left" Command="{Binding Cmd_AddClick.Command}" CommandParameter="{Binding ElementName=lv_UserDefiniedDataItems}"/>
                    <Button Height="23" Width="100" Content="{ Binding Cmd_EditClick.ViewName}" HorizontalAlignment="Left" Margin="125,5,0,5" Grid.Row="1" IsEnabled="{Binding CustomItemSelected}" Command="{Binding Cmd_EditClick.Command}" CommandParameter="{Binding ElementName=lv_UserDefiniedDataItems}"/>
                    <Button Height="23" Width="100" Content="{Binding Cmd_DeleteClick.ViewName}" HorizontalAlignment="Left" Margin="239,5,0,5" Grid.Row="1" IsEnabled="{Binding CustomItemSelected}" Command="{Binding Cmd_DeleteClick.Command}" CommandParameter="{Binding ElementName=lv_UserDefiniedDataItems}"/>
                </Grid>
            </TabItem>
            <TabItem Header="Assignments">
                <Grid Background="#FFE5E5E5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="41"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="40"/>
                    </Grid.RowDefinitions>
                    <ListView x:Name="lv_UserDefinedAssignments"  Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" ItemsSource="{Binding CustomAssignments}" SelectedItem="{Binding SelectedAssignment}">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="Category" Width="200" DisplayMemberBinding="{Binding Value}"/>
                                <GridViewColumn Header="File-Extension" Width="200" DisplayMemberBinding="{Binding Key}" />
                            </GridView>
                        </ListView.View>
                    </ListView>
                    <Button Content="{Binding Cmd_AddAssignmentClick.ViewName}" Grid.Column="0" Grid.Row="1" Margin="10,10,0,10" Width="100" Grid.ColumnSpan="2" HorizontalAlignment="Left" Command="{Binding Cmd_AddAssignmentClick.Command}" CommandParameter="{Binding ElementName=lv_UserDefinedAssignments}" />
                    <Button Content="{Binding Cmd_EditAssignmentClick.ViewName}" HorizontalAlignment="Right" Margin="0,10,416,10" Grid.Row="1" Width="100" Grid.Column="1" IsEnabled="{Binding CustomAssignmentSelected}" Command="{Binding Cmd_EditAssignmentClick.Command}" CommandParameter="{Binding ElementName=lv_UserDefinedAssignments}"/>
                    <Button Content="{Binding Cmd_DeleteAssignmentClick.ViewName}" HorizontalAlignment="Left" Margin="198,10,0,10" Grid.Row="1" Width="100" Grid.Column="1" IsEnabled="{Binding CustomAssignmentSelected}" Command="{Binding Cmd_DeleteAssignmentClick.Command}" CommandParameter="{Binding ElementName=lv_UserDefinedAssignments}"/>
                </Grid>
            </TabItem>
        </TabControl>
        <StackPanel Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="4"  Orientation="Horizontal" FlowDirection="RightToLeft">
            <Button Content="{Binding Cmd_ApplyClick.ViewName}" Margin="10,10,5,5" Height="23" Width="100" Command="{Binding Cmd_ApplyClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditDataSource}"/>
            <Button Content="{Binding Cmd_CloseClick.ViewName}" Margin="15,10,0,5" Height="23" Width="100" Command="{Binding Cmd_CloseClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditDataSource}"/>
            <Button Content="{Binding Cmd_OkClick.ViewName}" Margin="5,10,0,5" Height="23" Width="100" Command="{Binding Cmd_OkClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditDataSource}"/>

        </StackPanel>
    </Grid>
</Window>
